<aside class="sidebar left-sidebar sticky">
    <button class="hamburger hamburger--spin" type="button" id="toggle-menu" aria-label="{{ T `toggleMenu` }}">
        <span class="hamburger-box">
            <span class="hamburger-inner"></span>
        </span>
    </button>

    <header class="site-info">
        <a href="{{ .Site.BaseURL }}">
            <div class="site-avatar-container">
                {{ with .Site.Params.sidebar.avatar }}
                {{ if (default true .enabled) }}
                    <figure class="site-avatar">
                        {{ if not .local }}
                        <img src="{{ .src }}" width="300" height="300" class="site-logo" loading="lazy" alt="Avatar">
                        {{ else }}
                        {{ $avatar := resources.Get (.src) }}

                        {{ if $avatar }}
                        {{ $avatarResized := $avatar.Resize "300x" }}
                        <img src="{{ $avatarResized.RelPermalink }}" width="{{ $avatarResized.Width }}"
                            height="{{ $avatarResized.Height }}" class="site-logo" loading="lazy" alt="Avatar">
                        {{ else }}
                        {{ errorf "Failed loading avatar from %q" . }}
                        {{ end }}
                        {{ end }}

                        {{ with $.Site.Params.sidebar.emoji }}
                        <span class="emoji">{{ . }}</span>
                        {{ end }}
                    </figure>
                    {{ end }}
                {{ end }}
            </div>
        </a>

        <h1 class="site-name"><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1>
        <h2 class="site-description">{{ .Site.Params.sidebar.subtitle }}</h2>

        <div class="site-icon">
            <!-- {{ with .Site.Params.sidebar.twitter }} -->
            <!-- <a href="https://twitter.com/{{ .username }}" target="_blank"> -->
            <!--     {{ partial "helper/icon" "twitter"}} -->
            <!-- </a> -->
            <!-- {{end}} -->
            <!-- &nbsp; -->
            {{ with .Site.Params.sidebar.github }}
            <a href="https://github.com/{{ .username }}" target="_blank">
                {{ partial "helper/icon" "github"}}
            </a>
            {{end}}
            <!-- &nbsp; -->
            <!-- {{ with .Site.Params.sidebar.email }} -->
            <!-- <a href="mailto:{{ .email }}" target="_blank"> -->
            <!--     {{ partial "helper/icon" "email"}} -->
            <!-- </a> -->
            <!-- {{end}} -->
            <!-- &nbsp; -->
            <!-- {{ with .Site.Params.sidebar.telegram }} -->
            <!-- <a href="https://t.me/{{ .username }}" target="_blank"> -->
            <!--     {{ partial "helper/icon" "telegram"}} -->
            <!-- </a> -->
            <!-- {{end}} -->
            {{ with .Site.Params.sidebar.gpg }}
            <a href="{{ .url }}" target="_blank">
                {{ partial "helper/icon" "key"}}
            </a>
            {{end}}
            {{ with .Site.Params.sidebar.rss }}
            <a href="{{ "index.xml" | absURL }}" target="_blank">
                {{ partial "helper/icon" "rss"}}
            </a>
            {{end}}
        </div>
    </header>

    <ol class="menu" id="main-menu">
        {{ $currentPage := . }}
        {{ range .Site.Menus.main }}
        {{ $active := or (eq $currentPage.Title .Name) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}

        <li {{ if $active }} class='current' {{ end }}>
            <a href='{{ .URL | relURL }}'>
                {{ if .Pre }}
                {{ partial "helper/icon" .Pre }}
                {{ end }}
                <span>{{- .Name -}}</span>
            </a>
        </li>
        {{ end }}
        
        {{ if (default false .Site.Params.colorScheme.toggle) }}
        <li id="dark-mode-toggle">
            {{ partial "helper/icon" "toggle-left" }}
            {{ partial "helper/icon" "toggle-right" }}
            <span>{{ T "darkMode" }}</span>
        </li>
    {{ end }}
    </ol>
    <div class="to-top">
        <button class="to-top-button" id="to-top-button">
            {{ partial "helper/icon" "to-top" }}
        </button>
    </div>
</aside>
